<template>
  <!-- 搜索单曲页 -->
  <div class="searchSon">
    <!-- 歌曲总数 -->
    <div class="count"></div>

    <!-- 歌曲列表和分页 -->
    <div class="main">
        <!-- 歌曲列表 -->
       <Sonlist :songlist="songlist"></Sonlist>

       <!-- 分页 -->
       
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref , reactive, computed} from 'vue';
import { searchApi } from '../../api/search/hotsearch'
import { useRoute } from 'vue-router';

const route = useRoute()

let keywords = ref(route.params.keywords) 


const pageInfo = reactive({
  pageSize: 30,
  curPage: 1, // 当前页
  total: 0, // 总页数
})





let songlist = ref()

async function getSearchSongs() {
    let res:any = await searchApi(keywords.value, 1, (pageInfo.curPage - 1) * 30)
    console.log(res);
    songlist.value =  res.result.songs
    pageInfo.total = res.result.songCount
    

}

getSearchSongs()

</script>

<style lang="less" scoped>

</style>